package com.zkyc.framework.website.mapper;

import com.zkyc.framework.common.mp.EasyBaseMapper;
import com.zkyc.framework.common.pojo.Moudle;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * (Moudle)表数据库访问层
 *
 * @author libingchuan
 * @since 2022-05-24 16:33:26
 */
@Mapper
public interface MoudleMapper extends EasyBaseMapper<Moudle>{

    @Select("select id from web_moudle where is_deleted = 0 and website_id = #{websiteId}")
    List<Integer> queryMoudleByWebsiteId(String websiteId);

    @Select("select id from web_moudle where is_deleted = 0 and website_id = #{websiteId}")
    List<Integer> queryMoudleByWebsiteIdPlus(Integer websiteId);

    @Delete("<script>" +
            "DELETE FROM web_moudle WHERE id IN" +
            "    <foreach item='item' index='index' collection='moduleIdList' open='(' separator=',' close=')'>" +
            "       #{item}" +
            "    </foreach>" +
            "</script>"
    )
    int realDeleteByIds(List<Integer> moduleIdList);
}

